package com.bosssoft.cloud.wechat.infrastructure.util;

import cn.hutool.core.bean.BeanUtil;
import com.bosssoft.cloud.wechat.infrastructure.enums.ErrEnum;
import com.bosssoft.cloud.wechat.infrastructure.exception.SystemException;

import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * Bean转换工具类
 *
 * @author wcy create on 2021/5/18 9:49 上午
 */
public class EBeanUtil {

    /**
     * 执行Bean转换
     *
     * @param source 源Bean
     * @param clazz  目标class
     * @param <T>    T
     * @return 转换后的Bean
     */
    public static <T> T toBean(Object source, Class<T> clazz) {
        T target = BeanUtil.toBean(source, clazz);
        copyProperties(source, target);
        return target;
    }

    /**
     * 手动处理转换参数
     *
     * @param source 源Bean
     * @param target 目标Bean
     */
    private static void copyProperties(Object source, Object target) {
    }
}
